package com.godpaper.as9.bussiness.delegates
{
	import com.adobe.cairngorm.business.ServiceLocator;
	import com.godpaper.as9.constants.ServiceInfoList;
	
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;

	public class PhotoDelegate extends DelegateBase implements IResponder
	{
		public function PhotoDelegate(responder:IResponder)
		{
			super(responder);
			this.service = ServiceLocator.getInstance().getRemoteObject(ServiceInfoList.SERVICE_PHOTO);
		}
		
		public function getPhotoList(albumID:int,setBusyCursor:Boolean=true,showProgressBar:Boolean=true):void
		{
			var token:AsyncToken = service.getOperation(ServiceInfoList.OPERATION_GET_PHOTO_LIST).send(albumID);
			token.addResponder(this);
			
			setProgressStatus(setBusyCursor,showProgressBar);
		}
		
		public function findPhotosByTag(tag:String,setBusyCursor:Boolean=true,showProgressBar:Boolean=true):void
		{
			var token:AsyncToken = service.getOperation(ServiceInfoList.OPERATION_FIND_PHOTOS_BY_TAG).send(tag);
			token.addResponder(this);
			
			setProgressStatus(setBusyCursor,showProgressBar);
		}
		
		public function findPhotosByName(name:String,setBusyCursor:Boolean=true,showProgressBar:Boolean=true):void
		{
			var token:AsyncToken = service.getOperation(ServiceInfoList.OPERATION_FIND_PHOTOS_BY_NAME).send(name);
			token.addResponder(this);
			
			setProgressStatus(setBusyCursor,showProgressBar);
		}
		
		public function getThumbnailList(setBusyCursor:Boolean=true,showProgressBar:Boolean=true):void
		{
			var token:AsyncToken = service.getOperation(ServiceInfoList.OPERATION_GET_THUMBNAIL_LIST).send();
			token.addResponder(this);
			
			setProgressStatus(setBusyCursor,showProgressBar);
		}
	}
}